package com.ctgu.computer.controller.admin;

import com.ctgu.computer.common.SuccessMessage;
import com.ctgu.computer.domain.dto.CheckDTO;
import com.ctgu.computer.domain.dto.CheckReportDTO;
import com.ctgu.computer.domain.dto.PageQueryDTO;
import com.ctgu.computer.domain.result.PageResult;
import com.ctgu.computer.domain.result.Result;
import com.ctgu.computer.service.CheckService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.x.file.storage.core.exception.Check;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.awt.desktop.SystemEventListener;
import java.util.ArrayList;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/sys/admin/check")
@RequiredArgsConstructor
@Tag(name = "管理员审核举报信息相关接口")
public class CheckController {
    private final CheckService checkService;
    @Operation(summary = "分页查询所有用户的举报信息")
    @PostMapping("/list")
    public Result<PageResult> getAllUserReport(@RequestBody PageQueryDTO pageQueryDTO){
        return Result.success(checkService.getAllUserReport(pageQueryDTO));
    }

    @Operation(summary = "根据审核状态查询举报信息")
    @PostMapping("/list/status")
    public Result<PageResult> getUserReportByStatus(@RequestBody CheckDTO checkDTO){
        return Result.success(checkService.getUserReportByStatus(checkDTO));
    }

    @Operation(summary = "管理员批量审核通过帖子")
    @PostMapping("/agree")
    public Result PassCheck(@RequestBody List<Integer> ids){
        System.out.println("举报信息"+ids);
        checkService.passCheck(ids);
        return Result.success();
    }

    @Operation(summary = "管理员批量审核驳回帖子")
    @PostMapping("/refuse")
    public Result RefuseCheck(@RequestBody List<Integer> ids){
        checkService.refuseCheck(ids);
        return Result.success();
    }

}
